﻿using System;
using System.Collections.Generic;
using System.Linq;
using WCFHostingModel;

namespace WCFHostingServiceLibrary
{
    public class TestData
    {
        private static readonly List<string> UserName = new List<string> {"安世界", "钟晓静", "马飞鹰"};

        static TestData()
        {
            Init();
        }

        public static IList<UserModel> Users { get; private set; }

        public static IList<ArticleModel> Articles { get; private set; }

        private static void Init()
        {
            if (Users == null)
                Users =
                    Enumerable.Range(1, UserName.Count)
                        .Select(
                            x =>
                                new UserModel
                                {
                                    Uid = x.ToString(),
                                    Name = UserName[x - 1],
                                    Password = Guid.NewGuid().ToString()
                                })
                        .ToList();
            if (Articles == null)
                Articles = new List<ArticleModel>
                {
                    new ArticleModel
                    {
                        Aid = "1",
                        Author = "Shweta Lodha",
                        Title = "Which WCF Template To Be Used",
                        Url = "http://www.c-sharpcorner.com/blogs/which-wcf-template-to-be-used"
                    },
                    new ArticleModel
                    {
                        Aid = "2",
                        Author = "Nitin Pandit",
                        Title = "WCF Interview Questions and Answers",
                        Url = "http://www.c-sharpcorner.com/UploadFile/8ef97c/wcf-interview-questions-and-answers/"
                    },
                    new ArticleModel
                    {
                        Aid = "3",
                        Author = "Chamali Perera",
                        Title = "Accessing Microsoft Dynamics CRM Web APIs Using Self-Hosted WCF Services",
                        Url = "http://www.c-sharpcorner.com/article/accessing-microsoft-dynamics-crm-web-apis-using-self-hosted-wcf-services/"
                    },
                    new ArticleModel
                    {
                        Aid = "4",
                        Author = "初闻",
                        Title = "Qt下实现简单的UDP通信",
                        Url = "http://www.cnblogs.com/wulizhiwen/p/6551183.html"
                    },
                    new ArticleModel
                    {
                        Aid = "5",
                        Author = "陈希章@中国",
                        Title = "SQL Server中的命名管道(named pipe)及其使用",
                        Url = "http://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441913.html"
                    },
                    new ArticleModel
                    {
                        Aid = "6",
                        Author = "陈希章@中国",
                        Title = "在ASP.NET Web API项目中使用Hangfire实现后台任务处理",
                        Url = "http://www.cnblogs.com/chenxizhang/p/4740921.html"
                    },
                    new ArticleModel
                    {
                        Aid = "7",
                        Author = "陈希章@中国",
                        Title = "使用Expression Tree构建动态LINQ查询",
                        Url = "http://www.cnblogs.com/chenxizhang/p/3916630.html"
                    }
                };
        }
    }
}